#!/usr/bin/env python
import os,sys
from PIL import Image

def change_to_program_dir():
    os.chdir(os.path.abspath(os.path.dirname(sys.argv[0])))

def win_quote1(str):
    "Quote command line in \" .... \" if there is spaces in string, for Windows command line"
    if " " in str:
        str = '"' + str + '"'
    return str

def win_quote2(str):
    "Quote command line in \" .... \" if there is spaces in string, for Windows command line"
    if " " in str:
        str = '"' + str + '"'
    return str

def convert_to_bmp(imgfile, bmpfile):
    im = Image.open(imgfile)
    im.save(bmpfile, "bmp")
